﻿@model IEnumerable<Entidades.ENContrato>
@using EncomiendaMVC.Helpers

@{
    WebGrid grid = new WebGrid(rowsPerPage: 3, ajaxUpdateContainerId: "listadoContratos");
    grid.Bind(Model, autoSortAndPage: false,
    rowCount: ViewBag.TotalVirtual);
    ViewBag.Title = "Contratos";   
}

<link href="@Url.Content("~/Content/fancy/jquery.fancybox.css")" rel="stylesheet" />
<script src="@Url.Content("~/Scripts/jquery.fancybox.js")"></script>
<script type="text/javascript" src="@Url.Content("~/Scripts/base/modModal.js")"></script>

<link href="@Url.Content("~/Content/estiloGrilla.css")" rel="stylesheet" />
@*<link href="@Url.Content("~/Content/admin.css")" rel="stylesheet" />*@
@*<script src="@Url.Content("~/Scripts/jquery.paginate.js")"></script>
<script src="@Url.Content("~/Scripts/base/modPaginacion.js")"></script>*@

@Html.Titulo("Contratos")

<p>
    @Html.ActionLink("Registrar", "Create", null, new { @class="btn btn-primary" })
</p>
<br />

<div id="listadoContratos">
@grid.GetHtml(
            //fillEmptyRows: true,
            //alternatingRowStyle: "fila-alternativa",
                headerStyle: "encabezado-grid a-la-derecha",
                footerStyle: "pie-grid",           
                mode: WebGridPagerModes.All,
                firstText: "<< Primera",
                previousText: "< Anterior",
                nextText: "Siguiente >",
                lastText: "Última >>",
    columns: new [] {
        grid.Column("ID",header: "ID", canSort: false),
        grid.Column("Cliente",header: "Pasajero", canSort: false),
        grid.Column("FechaSalida",header: "Fecha de Salida"),
        grid.Column("FechaLlegada",header: "Fecha de Llegada"),
        grid.Column("Ruta",header: "Ruta"),
        grid.Column("Aerolinea",header: "Aerolinea"),
        grid.Column("Vuelo",header: "Vuelo"),
        grid.Column("Estado",header: "Estado"),
        grid.Column("", 
                    header: "Acciones",
                    format: @<text>         
                                @Html.ActionLink("Detalle",  "Detalle",   new { idContrato= item.ID}, new { @class="btn btn-info modalVista" })
                                |        
                                @Html.ActionLink("Editar",   "Editar",   new { idContrato= item.ID}, new { @class="btn btn-warning modalVista" })
                                |
                                @Html.ActionLink("Eliminar", "Eliminar", new { idContrato=item.ID} , new { @class="btn btn-danger modalVista" } )
                            </text>
        )
})
</div>
@*@using (Html.BeginForm())
{
<table border="1">
    <tr>       
         <th>
            @Html.DisplayNameFor(model => model.Cliente)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.FechaSalida)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.FechaLlegada)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Ruta)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Aerolinea)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Vuelo)
        </th>     
        <th>
            @Html.DisplayNameFor(model => model.Estado)
        </th>
        <th></th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.Cliente)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.FechaSalida)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.FechaLlegada)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Ruta)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Aerolinea)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Vuelo)
        </td>      
        <td>
            @Html.DisplayFor(modelItem => item.Estado)
        </td>      
        <td>
            @Html.ActionLink("Detalle",  "Detalle",   new { idContrato= item.ID}, new { @class="btn btn-link modalVista" })
                                |        
            @Html.ActionLink("Editar",   "Editar",   new { idContrato= item.ID}, new { @class="btn btn-link modalVista" })
                                |
            @Html.ActionLink("Eliminar", "Eliminar", new { idContrato=item.ID} , new { @class="btn btn-link modalVista" } )
                      
        </td>
    </tr>
}
</table>

    @Html.Hidden("pagina", 1)
    @Html.Hidden("totalReg", (int)ViewBag.TotalVirtual)

    <div class="pagination-conteiner">
        <div class="pagList">
            <div id="paginador"></div>
        </div>
        <div class="nomlist" style="display:none">
            <b><span class="total-registros">Total de Registros: 
            @ViewBag.TotalVirtual
            </span></b>
        </div>
    </div>
}*@
